#ifndef _SYS_SERVICE_H_
#define _SYS_SERVICE_H_

#include "FanObj.h"
#include "SysTypes.h"

#define SERVICE_VTABLE(self)   ((ServiceVTable*)((FanObj*)self)->vtable)


extern Type*    Service_classType;
extern VTable*  Service_classVTable;


/* [sys::Service] Attributes */
struct Service
{
  FanObj        super;
};


/* [sys::Service] Virtual-table */
typedef struct ServiceVTable
{
  FanObjVTable  super;
  void          (*onStart)(Service* self);
  void          (*onStop)(Service* self);
} ServiceVTable;


/* [sys::Service] Methods and fields */
Bool            Service_equals(Service* self, NullableObj that);
Int             Service_hash(Service* self);
List*           Service_list(void);
Service*        Service_find_1(Type* t);
Service*        Service_find(Type* t, Bool checked);
List*           Service_findAll(Type* t);
Bool            Service_isInstalled(Service* self);
Bool            Service_isRunning(Service* self);
Service*        Service_install(Service* self);
Service*        Service_start(Service* self);
Service*        Service_stop(Service* self);
Service*        Service_uninstall(Service* self);
void            Service_onStart(Service* self);
void            Service_onStop(Service* self);


/* [sys::Service] Type-system functions */
Type*           Service_initType(void);
VTable*         Service_initVTable(void);
void            Service_initStatic(void);


#endif
